namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKTH10Viewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblList_Tk_CP;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private LabelControl lblTk_List_GT;
        private TextControl txtList_Tk_CP;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtTk_List_GT;

        public FormKTH10Viewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
            this.txtList_Tk_CP.Value = "621,622,623,627,635,641,642";
            this.txtTk_List_GT.Value = "152,153,155,156,157,159,11,14,33";
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormKTH10Viewer));
            this.txtNgay_Ct2 = new TextDate();
            this.lblNgay_Ct2 = new LabelControl();
            this.txtNgay_Ct1 = new TextDate();
            this.lblNgay_Ct1 = new LabelControl();
            this.txtTk_List_GT = new TextControl();
            this.lblTk_List_GT = new LabelControl();
            this.lblList_Tk_CP = new LabelControl();
            this.txtList_Tk_CP = new TextControl();
            base.rptContainer.Panel1.SuspendLayout();
            base.rptContainer.SuspendLayout();
            base.SuspendLayout();
            base.rptContainer.Panel1.Controls.Add(this.txtList_Tk_CP);
            base.rptContainer.Panel1.Controls.Add(this.lblList_Tk_CP);
            base.rptContainer.Panel1.Controls.Add(this.txtTk_List_GT);
            base.rptContainer.Panel1.Controls.Add(this.lblTk_List_GT);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            base.rptContainer.SplitterDistance = 0x43;
            this.txtNgay_Ct2.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct2.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new Point(0x13c, 0x2d);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 9;
//            this.txtNgay_Ct2.Value = null;//manager.GetObject("txtNgay_Ct2.Value");
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct2.Location = new Point(0x100, 0x30);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new Size(0x36, 14);
            this.lblNgay_Ct2.TabIndex = 0x61;
            this.lblNgay_Ct2.Text = "Đến ngày";
            this.txtNgay_Ct1.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct1.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new Point(0x6c, 0x2d);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 8;
//            this.txtNgay_Ct1.Value = null;//manager.GetObject("txtNgay_Ct1.Value");
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct1.Location = new Point(12, 0x30);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new Size(0x2f, 14);
            this.lblNgay_Ct1.TabIndex = 0x62;
            this.lblNgay_Ct1.Text = "Từ ngày";
            this.txtTk_List_GT.CharacterCasing = CharacterCasing.Upper;
            this.txtTk_List_GT.CheckTextSearched = false;
            this.txtTk_List_GT.DisabledForeColor = Color.Blue;
            this.txtTk_List_GT.Font = new Font("Arial", 8.25f);
            this.txtTk_List_GT.Location = new Point(0x6c, 0x18);
            this.txtTk_List_GT.MaxLength = 0xfe;
            this.txtTk_List_GT.Name = "txtTk_List_GT";
            this.txtTk_List_GT.OldValue = null;
            this.txtTk_List_GT.Size = new Size(0x134, 20);
            this.txtTk_List_GT.TabIndex = 7;
            this.txtTk_List_GT.UserTextLength = AppInstance.TextControlLength.InvoiceDescription;
//            this.txtTk_List_GT.Value = null;//manager.GetObject("txtTk_List_GT.Value");
            this.lblTk_List_GT.AutoSize = true;
            this.lblTk_List_GT.Font = new Font("Arial", 8.25f);
            this.lblTk_List_GT.Location = new Point(12, 0x1b);
            this.lblTk_List_GT.Name = "lblTk_List_GT";
            this.lblTk_List_GT.Size = new Size(0x5f, 14);
            this.lblTk_List_GT.TabIndex = 0x73;
            this.lblTk_List_GT.Text = "Tài khoản giảm trừ";
            this.lblList_Tk_CP.AutoSize = true;
            this.lblList_Tk_CP.Font = new Font("Arial", 8.25f);
            this.lblList_Tk_CP.Location = new Point(12, 6);
            this.lblList_Tk_CP.Name = "lblList_Tk_CP";
            this.lblList_Tk_CP.Size = new Size(0x57, 14);
            this.lblList_Tk_CP.TabIndex = 0x73;
            this.lblList_Tk_CP.Text = "Tài khoản chi phí";
            this.txtList_Tk_CP.CharacterCasing = CharacterCasing.Upper;
            this.txtList_Tk_CP.CheckTextSearched = false;
            this.txtList_Tk_CP.DisabledForeColor = Color.Blue;
            this.txtList_Tk_CP.Font = new Font("Arial", 8.25f);
            this.txtList_Tk_CP.Location = new Point(0x6c, 3);
            this.txtList_Tk_CP.MaxLength = 0xfe;
            this.txtList_Tk_CP.Name = "txtList_Tk_CP";
            this.txtList_Tk_CP.OldValue = null;
            this.txtList_Tk_CP.Size = new Size(0x134, 20);
            this.txtList_Tk_CP.TabIndex = 7;
            this.txtList_Tk_CP.UserTextLength = AppInstance.TextControlLength.InvoiceDescription;
//            this.txtList_Tk_CP.Value = null;//manager.GetObject("txtList_Tk_CP.Value");
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CheckDetailMost = true;
            base.ClientSize = new Size(0x31a, 0x1cf);
            base.Name = "FormKTH10Viewer";
            base.rptContainer.Panel1.ResumeLayout(false);
            base.rptContainer.Panel1.PerformLayout();
            base.rptContainer.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[4][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Ma_Km";
            objArray2[1] = "Khoản mục";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Ten_Km";
            objArray3[1] = "Tên khoản mục";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            objArray[2] = new object[] { "Tien", "Tiền", "N", AppInstance.TextNumericFormat.LocalAmount };
            objArray[3] = new object[] { "Tien_Nt", "Tiền nguyên tệ", "N", AppInstance.TextNumericFormat.ForeignAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            base.LocalTable = new ReportDataAccess().KTH10_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtList_Tk_CP.Value, this.txtTk_List_GT.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
        }
    }
}

